<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.*" %>
<html>
<head>
    <title>动态接收参数</title>
</head>
<body>
<%
    request.setCharacterEncoding("UTF-8"); // 设置请求编码
    response.setCharacterEncoding("UTF-8"); // 设置响应编码
    Enumeration<String> enumeration = request.getParameterNames(); // 实现了全部请求参数的接收
    while (enumeration.hasMoreElements()) { // 直接迭代
        String paramName = enumeration.nextElement(); // 获取参数名称
%>
        <h2><%=paramName%> = <%=java.util.Arrays.toString(request.getParameterValues(paramName))%></h2>
<%
    }
%>

<%
    request.setCharacterEncoding("UTF-8"); // 设置请求编码
    response.setCharacterEncoding("UTF-8"); // 设置响应编码
    Map<String, String[]> paramMap = request.getParameterMap(); // 获取全部参数和内容
    for (Map.Entry<String, String[]> entry : paramMap.entrySet()){
%>
        <h2><%=entry.getKey()%> = <%=java.util.Arrays.toString(entry.getValue())%></h2>
<%
    }
%>
</body>
</html>
